#include <func.h>
#define MAXSIZE 1000
int main(int argc,char *argv[])
{
    int shmid=shmget(IPC_PRIVATE,4096,IPC_CREAT|0600);
    int *p=(int*)shmat(shmid,NULL,0);
    p[0]=0;
    if(fork()==0)
    {
        int i;
        for(i=0;i<MAXSIZE;i++)
        {
            p[0]++;
        }
    }
    else
    {
        int i;
        for(i=0;i<MAXSIZE;i++)
        {
            p[0]++;
        }

    }
    printf("p[0]=%d",p[0]);
    wait(NULL);
    shmdt(p);

    return 0;
}

